package com.cv.audit.service.report;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjUtil;
import com.cv.audit.controller.audit.report.vo.AuditReportLogPageReqVO;
import com.cv.audit.controller.audit.report.vo.AuditReportLogRespVO;
import com.cv.audit.controller.audit.report.vo.AuditReportLogSaveReqVO;
import com.cv.audit.dal.dataobject.report.AuditReportLogDO;
import com.cv.audit.dal.mapper.report.AuditReportLogMapper;
import com.cv.framework.common.pojo.PageResult;
import com.cv.framework.security.core.utils.SecurityFrameworkUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 举报处理日志业务层接口实现类
 *
 * @author Charles_XDXD
 */
@Service
public class AuditReportLogServiceImpl implements AuditReportLogService {

    @Resource
    private AuditReportLogMapper auditReportLogMapper;

    @Override
    public void saveAuditReportLog(AuditReportLogSaveReqVO reqVO) {
        if (ObjUtil.isNotEmpty(reqVO)) {
            AuditReportLogDO auditReportLogDO = BeanUtil.toBean(reqVO, AuditReportLogDO.class);
            auditReportLogDO.setUserId(SecurityFrameworkUtil.getLoginUserId());
            auditReportLogMapper.insert(auditReportLogDO);
        }
    }

    @Override
    public PageResult<AuditReportLogRespVO> getPage(AuditReportLogPageReqVO reqVO) {
        return auditReportLogMapper.getPage(reqVO);
    }

}
